$(function() {
	$('#vue_vm_list div').hide();
});

var elderBedRecord = {
	id: '',
	elderId: '',
	subjectRoomId: getLoginedUser().subjectRoomId,
	subjectRoomName: getLoginedUser().subjectRoomName,
	houseTypeId: '',
	houseTypeName: '',
	houseTypeType: '',
	userVipCardId: '',
	vipCardRelation: '',
	buildingId: '',
	buildingName: '',
	floorsId: '',
	floorName: '',
	roomId: '',
	roomName: '',
	bedsId: '',
	bedNumber: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	beType: '',
};

var view = {
	data: elderBedRecord
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

findAll();

function save() {
	view.data.id = (view.data.id==''? 0: parseInt(view.data.id));
	view.data.houseTypeType = (view.data.houseTypeType==''? 0: parseInt(view.data.houseTypeType));
	view.data.bedNumber = (view.data.bedNumber==''? 0: parseInt(view.data.bedNumber));
	view.data.beType = (view.data.beType==''? 0: parseInt(view.data.beType));

	save_basic(path+'/elderBedRecord/save', {elderBedRecord:view.data}, function() {
		alert('保存成功');
		findAll();
	});
}

function findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/elderBedRecord/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/elderBedRecord/deleteBatch');
}
